package com.bdqn.pojo;

import java.io.Serializable;

/**
 * Student 学生类
 *
 * @author LILIBO
 * @since 2022-09-15
 */
public class Student implements Serializable {

    private static final long serialVersionUID = 1L;

    private String name;
    public static int age = 18;
    private String address;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    private Student(String name, int age, String address) {
        this.name = name;
        this.age = age;
        this.address = address;
    }

    public String getName() {
        System.out.println("调用了getName方法");
        return name;
    }

    private void setName(String name) {
        System.out.println("调用了setName方法");
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws RuntimeException {
        if (age < 0) {
            throw new RuntimeException("年龄不能为负数");
        }
        this.age = age;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * 内部类
     */
    class Score {

        private String subject;
        private int result;

        public String getSubject() {
            return subject;
        }

        public void setSubject(String subject) {
            this.subject = subject;
        }

        public int getResult() {
            return result;
        }

        public void setResult(int result) {
            this.result = result;
        }

        /**
         * 内部类
         */
        class Test {
            String test;
        }
    }
}
